import Vue from 'vue'
import App from './App'
import router from './router'
import store from './store'
import './../theme/index.css'
import qs from 'qs'
import gloabFun from "./mixin/gloabFun"
import ElementUI from 'element-ui'
import axios from "@/util/axios"
import Storage from "@/util/StorageUtil"
import * as echarts from 'echarts';
// import elTableInfiniteScroll from 'el-table-infinite-scroll';
//流程组件
import Ellipsis from '@/components/common/Ellipsis'
import WDialog from '@/components/common/WDialog'
import Tip from '@/components/common/Tip'

Vue.use(Ellipsis);
Vue.use(WDialog);
Vue.use(Tip);
// Vue.use(elTableInfiniteScroll);
require('@/util/CustomUtil')
// 123
Vue.use(ElementUI);
Vue.prototype.$qs = qs
Vue.prototype.$api = "http://127.0.0.1:9696/api"
Vue.prototype.$get = axios.get
Vue.prototype.$put = axios.put
Vue.prototype.$delete = axios.delete
Vue.prototype.$post = axios.post
Vue.prototype.$upload = axios.upload
Vue.prototype.$down = axios.down
Vue.prototype.$downs = axios.downs
Vue.prototype.$echarts=echarts
Vue.prototype.$bus= new Vue()
Vue.prototype.$deepCopy = function(obj) {
  return JSON.parse(JSON.stringify(obj))
}
Vue.prototype.$isNotEmpty = function(obj) {
  return (obj !== undefined && obj !== null && obj !== '' && obj !== 'null')
}
Vue.prototype.$getDefalut = function(obj, key, df) {
  return (obj === undefined || key === undefined || !this.$isNotEmpty(obj[key])) ? df : obj[key];
}

// 阻止启动生产消息
Vue.config.productionTip = false

// 防止连点
Vue.directive('throttle', {
  inserted(el, binding) {
    el.addEventListener('click', () => {
      el.style.pointerEvents = 'none'
      if (!el.disabled) {
        setTimeout(() => {
          el.style.pointerEvents = 'auto'
        }, binding.value || 1000)
      }
    })
  }
})

router.afterEach((to, from, next) => {
  window.scrollTo(0, 0)
})

const app = new Vue({
  el: '#app',
  router,
  store,
  components: {
    App
  },
  template: '<App/>'
})
